﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using zzh_the_Visual_Studio.DAL;
using zzh_the_Visual_Studio.Models;

namespace zzh_the_Visual_Studio.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManageController : ControllerBase
    {
        private DAL_Manage dalmanage = new DAL_Manage();

        [HttpGet]
        //管理员主页
        public List<manage> getManage()
        {
            return dalmanage.getManage();
        }
        //详细学生信息，s_id,姓名，学号，电话，身份证，学年，班级名称，专业名称，二级学院
        public List<manage_students> detailStudents()
        {
            return dalmanage.detailStudents();
        }
        //学生页面翻页
        public List<manage_students> limitStudents(int page)
        {
            var _page = 0 + page * 10;
            return dalmanage.limitStudents(_page);
        }
        //学生模糊查询
        public List<manage_students> selectStudents(string s)
        {
            return dalmanage.selectStudents(s);
        }
        //教师详细信息
        public List<manage_teachers> detailTeachers()
        {
            return dalmanage.detailTeachers();
        }
        //学生页面翻页
        public List<manage_teachers> limitTeachers(int page)
        {
            var _page = 0 + page * 10;
            return dalmanage.limitTeachers(_page);
        }
        //教师的模糊查询
        public List<manage_teachers> selectTeachers(string s)
        {
            return dalmanage.selectTeachers(s);
        }
        //新增学生信息
        [HttpPost]
        public int createStudents(students s)
        {
            return dalmanage.createStudents(s);
        }
        //删除学生信息
        [HttpGet]
        public int deleteStudents(int id)
        {
            return dalmanage.deleteStudents(id);
        }
        //查看学生成绩
        public List<students_scores> getScores()
        {
            return dalmanage.getScores();
        }
        //修改学生成绩
        [HttpPost]
        public int changeScores(scores s)
        {
            return dalmanage.changeScores(s);
        }
        [HttpGet]
        //成绩模糊查询
        public List<students_scores> selectScores(string s)
        {
            return dalmanage.selectScores(s);
        }
        //修改学生信息
        [HttpPost]
        public int changeStudents(students s)
        {
            return dalmanage.changeStudents(s);
        }
        //新增教师信息
        public int createTeachers(teachers t)
        {
            return dalmanage.createTeachers(t);
        }
        //删除教师信息
        [HttpGet]
        public int deleteTeachers(int id)
        {
            return dalmanage.deleteTeachers(id);
        }
        //修改教师信息
        [HttpPost]
        public int changeTeachers(teachers t)
        {
            return dalmanage.changeTeachers(t);
        }

    }
}